/**
 * Created by Administrator on 2016/11/11.
 */
(function(){
    var login2={
        init:function(){
            this.validate2();
            this.validate3();
        },
        validate2:function(){
            
            if ($("#register_form2").size() > 0){
            	var reg=/^\w{6,15}$/
        		$('form#register_form2').submit(function(e) {
        			if(!reg.test($(".password1").val())){
                        layer.msg("密码只支持6-15个字母、数字或下划线", {icon:2,time:1000});
                        $(".password1").val("");
                        return false;
                    }
                    if($(".password1").val()!=$(".password2").val()){
                        layer.msg("密码输入不一致", {icon:2,time:1000});
                        $(".password2").val("");
                        return false;
                    }
                    $("#register_form2 input.error").removeClass("error");
        		});
        	}
        },
        validate3:function(){
            
            if ($("#register_form3").size() > 0){
        		$('form#register_form3').submit(function(e) {
                    if($("input[name=username]").val().trim().length < 2){
                        layer.msg("请输入用户名", {icon:2,time:1000});
                        $("input[name=username]").val("");
                        return false;
                    }
                    $("#register_form3 input.error").removeClass("error");
        		});
        	}
        }
    };
    login2.init();

})();